<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<!DOCTYPE html>
<html>
	<head>
		<title><sitemesh:title/></title>
		<%@include file="/WEB-INF/views/include/head.jsp" %>
		<sitemesh:head/>
		<script type="text/javascript">
		global.loginPassword = "${fns:getLoginPw()}";
		global.bossPassword = "${fns:getStore().bossPassword}";
		$(document).ready(function() {
			setInterval(recordLastOptionTime, 1000);
			refreshMsgNumber();
			$(document).delegate('a', 'click', function() {
				var url = this.href;
				if(this.onclick){
					this.onclick();
					return;
				}
				if (url != "" && /(ftp|http|https)/.test(url) && url.indexOf("#") == -1) {
				  	window.location.href = url;
					return false;
			    } 
		    	return true;
			});
			$(".leave-clean-session").click(function(){
		 		var url = "${ctx}/cleanSession?sessionKeys=startDate,endDate";
		 		var backFun = function(){
					window.location.href = "${ctx}";
		 		};
		 		syncToServer(url, backFun);
		 	});
			$(".leave-not-clean-session").click(function(){
				window.location.href = "${ctx}";
		 	});
			$("#returnMenu").click(function(){
				sessionStorage.removeItem("hasParent");
			});
		});
		function recordLastOptionTime(){
			localStorage.lastUpdateTime = Date.parse(new Date());
		}
		function refreshMsgNumber(){
			//获得当前店面所有未读消息的数量
			var url = '${ctx}/message/systemNotifyMessage/msgNumber';
			jQuery.ajax({  
		          type : 'GET',  
		          url : url,  
		          success : function(data) {  
		          	if (data) {
			        	var dataJson = eval("("+data+")");
			        	if($('#tongzhi').text() == ''){
			        		$('#tixing', window.parent.document).html("(" + dataJson.alertStoreProduct + ")");
			        		$('#renwu', window.parent.document).html("(" + dataJson.unreadTaskNumber + ")");
			        		$('#tongzhi', window.parent.document).html("(" + dataJson.unreadSysNumber + ")");
			        	}
			        	$("#tixing").html("(" + dataJson.alertStoreProduct + ")");
			        	$("#renwu").html("(" + dataJson.unreadTaskNumber + ")");
			        	$("#tongzhi").html("(" + dataJson.unreadSysNumber + ")");
			          	}
		          }  
		     });
		}
	</script>
	</head>
	<body>
		<section data-role="page" id="horizontal" data-theme="a">
			<header id="header" data-role="header" data-position="fixed" data-tap-toggle="false">
		       	<a href="#dialog-menu" data-role="button" data-icon="myapp-logo" class="header-menu" data-iconpos="notext">菜单</a>
		       	<h1 data-inline="true">博通美容专家系统</h1>
	        </header>
	        
			<sitemesh:body/>
			
			<footer id="footer" data-role="footer" data-position="fixed" data-tap-toggle="false">
	            <h4>香港博通管理咨询有限公司</h4>
            	<div data-role="controlgroup" class="ui-btn-right" data-type="horizontal">
				    <a onclick="location.href='${ctx}/message/systemNotifyMessage/companyMsg'" data-role="button" class="toolbar" data-icon="myapp-tongzhi" data-iconpos="top"><label id="tongzhi"></label></a>
				    <a onclick="location.href='${ctx}/inventory/storeInventoryAlert/check'" data-role="button" class="toolbar" data-icon="myapp-tixing" data-iconpos="top"><label id="tixing"></label></a>
	     		 	<a onclick="location.href='${ctx}/message/storeEmployeeTask/list?status=0'" data-role="button" class="toolbar" data-icon="myapp-renwu" data-iconpos="top"><label id="renwu"></label></a>
	     		</div>
	       </footer>
		   <%@include file="/WEB-INF/views/include/dialog.html" %>
		</section>
	</body>
</html>